// vue.config.js
const path = require('path');
const resolve = (dir) => path.join(__dirname, dir);
const outputDirName = 'dist';

module.exports = {
    publicPath: './', // 基本路径
    outputDir: outputDirName, // 输出文件目录
    devServer: {
        disableHostCheck: true,
        proxy: {
            '/apis': {
                target: 'https://api.shanghaichujie.com/api/',
                ws: true,
                changeOrigin: true,
                pathRewrite: {
                    '^/apis': '',
                },
            }
        }
    },
    // eslint-loader 是否在保存的时候检查
    lintOnSave: true,
    // 去除map文件
    productionSourceMap: false,
    chainWebpack: (config) => {
        config.resolve.alias
            .set('@$', resolve('src'))
            .set('assets', resolve('src/assets'))
            .set('utils', resolve('src/assets/utils'))
            .set('api', resolve('src/api'))
            .set('components', resolve('src/components'))
            .set('stylus', resolve('src/assets/stylus'))
            .set('views', resolve('src/views'))
            .set('common', resolve('src/common'))
            .set('router', resolve('src/common'))
    }
};
